package com.yonyou.ucf.mdf.app.isvdxq.other.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.google.gson.Gson;
import com.yonyou.iuap.yms.annotation.YMSColumn;
import com.yonyou.iuap.yms.annotation.YMSEntity;
import com.yonyou.iuap.yms.annotation.YMSTable;
import com.yonyou.iuap.yms.param.BaseEntity;

import java.math.BigDecimal;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@YMSEntity
@YMSTable(tableName = "dxqyy_unit")
public class UnitEnity extends BaseEntity {

    private long id;

    private String code;

    private String unitName;

    private String unitGroup;

    @YMSColumn(name = "unitGroup_name")
    private String unitGroup_name;

    private int truncationType;

    private int precision;

    private Boolean bBaseUnit;

    private Boolean baseunit;

    private Boolean stopstatus;

    private Boolean isEnabled;

    private String modifier;

    private String creator;

    private String createTime;

    private String modifyTime;

    private String pubts;

    @YMSColumn(name = "ytenant_id")
    private String tenantId;

    private BigDecimal convertCoefficient;

    // list接口和详情接口数据不一致
    public void initData() {
        if (baseunit != null)
            bBaseUnit = baseunit;
        isEnabled = !stopstatus;
    }

    public Boolean getBaseunit() {
        return baseunit;
    }

    public void setBaseunit(Boolean baseunit) {
        this.baseunit = baseunit;
    }

    @Override
    public String toString() {
        return new Gson().toJson(this);
    }

    // 兼容订阅数据
    public void set_status(String _status) {
        if (_status == "Update") super.set_status(1);
        else if (_status == "Insert") {
            super.set_status(0);
        }
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getUnitName() {
        return unitName;
    }

    public void setUnitName(String unitName) {
        this.unitName = unitName;
    }

    public String getUnitGroup() {
        return unitGroup;
    }

    public void setUnitGroup(String unitGroup) {
        this.unitGroup = unitGroup;
    }

    public String getUnitGroup_name() {
        return unitGroup_name;
    }

    public void setUnitGroup_name(String unitGroup_name) {
        this.unitGroup_name = unitGroup_name;
    }

    public int getTruncationType() {
        return truncationType;
    }

    public void setTruncationType(int truncationType) {
        this.truncationType = truncationType;
    }

    public int getPrecision() {
        return precision;
    }

    public void setPrecision(int precision) {
        this.precision = precision;
    }

    public Boolean getbBaseUnit() {
        return bBaseUnit;
    }

    public void setbBaseUnit(Boolean bBaseUnit) {
        this.bBaseUnit = bBaseUnit;
    }

    public Boolean getStopstatus() {
        return stopstatus;
    }

    public void setStopstatus(Boolean stopstatus) {
        this.stopstatus = stopstatus;
    }

    public Boolean getEnabled() {
        return isEnabled;
    }

    public void setEnabled(Boolean enabled) {
        isEnabled = enabled;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(String modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getPubts() {
        return pubts;
    }

    public void setPubts(String pubts) {
        this.pubts = pubts;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public BigDecimal getConvertCoefficient() {
        return convertCoefficient;
    }

    public void setConvertCoefficient(BigDecimal convertCoefficient) {
        this.convertCoefficient = convertCoefficient;
    }
}
